<!-- <!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8"/>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
		<title>Map Example</title>
		<script type="text/javascript">
			var map = null;
			// 创建地图控件
			function createMap() {
				if(!map){
					map = plus.maps.create('map', {
						top:'0',
						left:'0',
						width: '100%',
						height: '300px',
						position: 'static'
					});
					plus.webview.currentWebview().append(map);
				}
			}
			// 查找地图控件
			function findMap() {
				var b = plus.maps.getMapById('map');
				if(b){
					console.log('find success!');
					alert('success');
				} else {
					console.log('find failed!');
					alert('failed');
				}
			}
		</script>
		<style type="text/css">
			*{
				-webkit-user-select: none;
			}
			html,body{
				margin: 0px;
				padding: 0px;
				height: 100%;
			}
		</style>
	</head>
	<body>
		<button onclick="createMap()">创建地图控件</button>
		<br/>
		<button onclick="findMap()">查找地图控件</button>
	</body>
</html> -->
<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8"/>
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
		<title>Map Example</title>
		<script type="text/javascript">
			var em=null,map=null;
			// H5 plus事件处理
			function plusReady(){
				// 确保DOM解析完成
				if(!em||!window.plus||map){return};
				map = new plus.maps.Map("map");
			}
			if(window.plus){
				plusReady();
			}else{
				document.addEventListener("plusready", plusReady, false);
			}
			// DOMContentloaded事件处理
			document.addEventListener("DOMContentLoaded", function(){
				em=document.getElementById("map");
				plusReady();
			},false);
			uni.postMessage({
				name: '正三',
				sex: '男'
			})
		</script>
		<style type="text/css">
			#map {
				width: 100%;
				position: fixed;
				top: 0px;
				bottom: 0px;
				line-height: 200px;
				text-align: center;
				background: #FFFFFF;
			}
		</style>
	</head>
	<body>
		<div id="map">地图加载中...</div>
	</body>
</html>